package cn.zhf.shop.controller;

import cn.zhf.shop.entity.Message;
import cn.zhf.shop.entity.Refund;
import cn.zhf.shop.entity.ServicePhone;
import cn.zhf.shop.service.ServicePhoneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(tags = "客服电话模块")
@RequestMapping("/api/ServicePhone/")
public class ServicePhoneController {

    @Resource
    private ServicePhoneService servicePhoneService;

    @PostMapping("/")
    @ApiOperation(value = "新增客服电话")
    public Message<?> insert(ServicePhone servicePhone){
        return servicePhoneService.insertSelective(servicePhone);
    }

    @GetMapping("/one")
    @ApiOperation(value = "根据id查看客服电话")
    public Message<ServicePhone> selectById(int id){
        return servicePhoneService.selectByPrimaryKey(id);
    }

    @GetMapping("/ALL")
    @ApiOperation(value = "查看所有客服电话")
    public Message<List<ServicePhone>> selectAll(){
        return servicePhoneService.selectAll();
    }

    @DeleteMapping("/")
    @ApiOperation(value = "根据id删除客服电话")
    public Message deleteById(int id)
    {
        return servicePhoneService.deleteByPrimaryKey(id);
    }

    @PutMapping("/")
    @ApiOperation(value = "修改客服电话")
    public Message updateById(ServicePhone servicePhone){
        return servicePhoneService.updateByPrimaryKeySelective(servicePhone);
    }
}